home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / cross / fast05.lha / Docs / covert.doc < prev    next >
Text File  |  1997-05-23  |  3KB  |  92 lines

  1.              COVERTING Asm05 SOURCE CODE TO MOTOROLA FORMAT
  2.  
  3. The Asm05 assembler is not compatable with standard 68HC05 assemblers. It
  4. borrows syntax from Intel & 6502 assemblers. Listed here are the
  5. differences.
  6.  
  7.  1) Motorola 4 char & 5 char codes have been converted to 3 character
  8. format
  9.   Motorola    FAST6805    Description
  10.    BHCC         BFC        Branch if half carry Flag Clear
  11.    BHCS         BFS        Branch if half carry Flag Set
  12.    BRSET     BBS        Branch if Bit Set
  13.    BRCLR     BBC        Branch if Bit Clear
  14.    BSET         SMB        Set Memory Bit
  15.    BCLR         CMB        Clear Memory Bit
  16.    STOP         STP        stop
  17.    WAIT         WAI        wait
  18.  
  19.  2) When refering to registers the Fast assemblers expect the register
  20.     name in the address field not the opcode.
  21.   Motorola    FAST6805
  22.    INCX         INC X    
  23.    DECX         DEC X
  24.    RORX         ROR X
  25.    ASLX         ASL X
  26.    CLRX         CLR X
  27.    COMX         COM X
  28.    LSLX         LSL X
  29.    LSRX         LSR X
  30.    NEGX         NEG X
  31.    TSTX         TST X
  32.    INCA         INC A        
  33.    DECA         DEC A
  34.    RORA         ROR A
  35.    ASLA         ASL A
  36.    CLRA         CLR A
  37.    COMA         COM A
  38.    LSLA         LSL A
  39.    LSRA         LSR A
  40.    NEGA         NEG A
  41.    TSTA         TST A
  42.  
  43.  3) The bit field instructions take a different format 
  44.      Motorola               Asm05
  45.    BSET 1,$50            SMB $50.1
  46.    BCLR 1,$50            CMB $50.1
  47.    BRCLR 1,$50,label        BBC $50.1 label     
  48.    BRSET 1,$50,label        BBS $50.1 label     
  49.  
  50.  4) In standard assemblers data tables uses db in front of each line
  51.     of the table.
  52.      Motorola               Asm05
  53.   db $FF,$77,$33,$EE        $FF,$77,$33,$EE        ; data table
  54.   dw #label
  55.  
  56.  5) In standard assemblers ROM vectors uses dw in front of each
  57.     vector to signify a word size.
  58.      Motorola               Asm05
  59.   dw #label            #label
  60.  
  61. To convert a file do the following
  62.  1) convert opcodes     - replace "BBS"         with "BSET" 
  63.  2) convert registers    - replace " X"          with "X"
  64.  3) convert bit fields     - replace " $**.*"      with " *,$**"
  65.  4) convert tables    _ replace "<tab>$"    with "<tab>db $"
  66.  
  67. To Convert variable declarations
  68.  1) - replace "<Name>"  with "<Name> EQU"
  69.  
  70. To Convert files containing named bits
  71.  1) replace "<bitname>" with "#,<bytename>"
  72.  
  73. Do It The Easy Way
  74.  
  75.  When converting files if all the bit fields are named then a simple
  76.  search & replace file is all that is required. The utility "TxtRep"
  77.  takes a replace file (a list of search & replaces) and a source file
  78.  and produces a new source file compatable with Motorola syntax. Just
  79.  make up a ".rep" file listing all the named bit fields & their Motorola
  80.  replacements (ie NameBIT|#,Name). Use the file "ISet.rep" to convert the
  81.  instruction set. Duplicate your  header file with the bit fields missing
  82.  and EQU added to variable  declarations. Use the alternate header when
  83.  assemblig via motorola.
  84.  
  85.  I usually make up a batch file which
  86.   1) makes a new copy of my Asm05 source (or sources)
  87.   2) uses TxtRep with ISet.rep to fix instruction set
  88.   3) uses TxtRep with a rep file to fix any bit fields
  89.   4) uses TxtRep with a rep file to add EQU to my variable declaration
  90.      files
  91.  
  92.